package com.guomao.exceptions;


import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class ExceptionHandlerA {

    @ExceptionHandler(ArithmeticException.class)
    public String handelException(Exception ex, Model model) {
        model.addAttribute("ex", ex.getMessage());
        return "error";
    }

    @ExceptionHandler(NullPointerException.class)
    public String handelException2(Exception ex, Model model) {
        model.addAttribute("ex", ex.getMessage());
        return "error";
    }
}
